package exception;

public class ClassCastException {

    public static void main(String[] args) {

        A b = new B();//向上转型

        B b2 = (B) b;//向下转型

        C c = (C) b;//C类不是B类的子类，C类引用指向B类对象时会抛出类型转换异常

    }
}


class A {}
class B extends A{}
class C extends A{}
